import http from "@/utils/http";
import type {
  AddTypeNodeParams,
  AddTypeNodeItem,
  RectificationTypeTreeItem,
  TypeStandardDetail,
  AddTypeStandardParams
} from "./type";

/**
 * 整改分类tree
 */
export const rectificationTypeTree = (data: any) => {
  return http.get<RectificationTypeTreeItem[]>("/crm/reform/type/node/listTree", data);
};

/**
 * 添加整改分类节点
 */
export const addRectificationType = (data: AddTypeNodeParams) => {
  return http.post<AddTypeNodeItem[]>("/crm/reform/type/node/add", data);
};

/**
 * 删除整改分类节点
 */
export const delRectificationType = (reformTypeId: string) => {
  return http.deleteMethod(`/crm/reform/type/node/softDelete/${reformTypeId}`);
};

/**
 * 添加/修改整改标准
 */
export const addRectificationTypeStandard = (reformTypeId: string, data: AddTypeStandardParams) => {
  return http.post<TypeStandardDetail>(`/crm/reform/type/detail/update/${reformTypeId}`, data);
};

/**
 *整改分类标准详情
 */
export const rectificationTypeTransfer = (reformTypeId: string) => {
  return http.get<TypeStandardDetail>(`/crm/reform/type/detail/${reformTypeId}`);
};
/**
 * 查询所有角色
 */
export const getAllRole = () => {
  return http.get("/crm/reform/type/getAllRole");
};
